package com.zjgeport.zjgdanger.common;


import com.zjgeport.zjgdanger.Charts.components.AxisBase;
import com.zjgeport.zjgdanger.Charts.formatter.IAxisValueFormatter;

import java.util.HashMap;
import java.util.List;


/**
 * Created by Philipp Jahoda on 14/09/15.
 */
public class GoodsCountXAxisFormatter implements IAxisValueFormatter
{

    private List<HashMap<String, String>> dataMap;

    public GoodsCountXAxisFormatter(List<HashMap<String, String>> data) {
        // maybe do something here or provide parameters in constructor
        this.dataMap = data;

    }

    @Override
    public String getFormattedValue(float value, AxisBase axis) {

        float percent = value / axis.mAxisRange;
        HashMap<String,String> map = this.dataMap.get((int) (this.dataMap.size() * percent));
        return map.get("COMP_ABBR").toString();
    }


}
